﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AssetLoanEnquiry.aspx.cs"
    Inherits="MTRC.ODMS.Web.SOM.AssetLoan.AssetLoanEnquiry" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="APJ.Web.UI.WebControls" Namespace="APJ.Web.UI.WebControls"
    TagPrefix="APJ" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="AjaxControlToolkit" %>
<%@ Register Src="~/UserControl/Menu/PageFoot.ascx" TagName="PageFoot" TagPrefix="WebStructure" %>
<%@ Register Src="~/UserControl/Menu/TabStrip.ascx" TagName="TabStrip" TagPrefix="WebStructure" %>
<%@ Register Src="~/UserControl/Menu/PageHead.ascx" TagName="PageHead" TagPrefix="WebStructure" %>
<%@ Register Src="~/UserControl/Menu/MainMenu.ascx" TagName="MainMenu" TagPrefix="WebStructure" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Operational Data Management System</title>
    <link href="<%=ResolveUrl("~/CSS/common.css")%>" rel="stylesheet" type="text/css" />
    <script src="../../jQuery/jquery-1.6.2.min.js" type="text/javascript"></script>
    <script type="text/jscript" language="JavaScript" src="../../Javascript/CommonFunction.js"></script>
    <link id="cssWait" rel="stylesheet" type="text/css" />
    <%-- add by gordon 20150812 | For Search Wait Cursor --%>
    <script src="../../Javascript/SOM/Common.js" type="text/javascript"></script>
    <style type="text/css">
        .HandCursorClass
        {
            cursor: pointer;
        }
        label
        {
            cursor: pointer;
        }
    </style>
    <script type="text/jscript">
        /* Add by Dylan 20150617 for ISSUE U48  */
        $(function () {
            $("#<%=this.chklShow.ClientID%>_0").click(function () {
                if ($(this)[0].checked) {
                    // modifidy by dylan 20150730 for u131
                    //$("#<%=this.cbxReturnItemOs.ClientID%>").attr({ disabled: "disabled", checked: "checked" });
                    $("#<%=this.cbxReturnItemOs.ClientID%>").attr({ checked: "checked" });
                } else {
                    // modifidy by dylan 20150730 for u131
                    // $("#<%=this.cbxReturnItemOs.ClientID%>").removeAttr("disabled").removeAttr("checked");
                    $("#<%=this.cbxReturnItemOs.ClientID%>").removeAttr("checked");
                }
            });
        });

        function OpenStaffContractorForm() {
            var strURL = "../Popup/PopupSearchStaff.aspx?PageID=AssetLoanEnquiry"
            window.showModalDialog(strURL, window, "DialogWidth:740px;DialogHeight:520px;help:no;status:no");
        }
        function OpenDepartmentCompany() {
            var strURL = "../Popup/PopupDepartmentCompany.aspx"
            window.showModalDialog(strURL, window, "DialogWidth:780px;DialogHeight:520px;help:no;status:no");
        }
        function OpenEntryPageMaximum(url)  //huangyao 20081129 in MTR office
        {
            /*******************add by jack 20151202 for using session store enquiry condition start**********************/
            document.getElementById("<%=HiddenFieldUrl.ClientID %>").value = url;
            document.getElementById("<%=btnSetSession.ClientID %>").click();
            //            //debugger;
            //            var aaa = url;
            //            //xopen(url, window.screen.width, window.screen.height,'yes',null);
            //            //xopen(url, 1024, 768,'yes',null);
            //            //alert("test by huangyao");
            //            //  window.moveTo(0,0);   
            //            //  window.resizeTo(screen.availWidth,screen.availHeight);   
            //            //  window.outerWidth=screen.availWidth;   
            //            //  window.outerHeight=screen.availHeight;   

            //            //            newwin = window.open("", "", "scrollbars=yes, toolbar=yes, menubar=yes, location=yes, status=yes,resizable=yes");
            //            //            if (document.all) {
            //            //                newwin.moveTo(0, 0);
            //            //                newwin.resizeTo(screen.width, screen.height - 25);
            //            //            }
            //            //            newwin.location = url;

            //            //added by Nathan 2015-08-15
            //            var dateFrom;
            //            var dateTo;
            //            var StaffID;
            //            var StaffName;
            //            var DepartmentCompany;
            //            var station = document.getElementById("ddlStation").value; //1
            //            var inputAll = document.getElementsByTagName("input");
            //            for (var i = 0; i < inputAll.length; i++) {
            //                if (inputAll[i].type == "text" && inputAll[i].id.indexOf("dtbFromDate") >= 0) {//2
            //                    dateFrom = inputAll[i].value;
            //                }
            //                if (inputAll[i].type == "text" && inputAll[i].id.indexOf("dtbToDate") >= 0) {//3
            //                    dateTo = inputAll[i].value;
            //                }
            //            }
            //            var FreeTextcblShow = getChackboxListValue("chklShow"); //4

            //            StaffID = document.getElementById("txtStaffID").value; //5
            //            StaffName = document.getElementById("txtStaffName").value; //6

            //            var ReturnItemOs = document.getElementById("cbxReturnItemOs").checked; //7
            //            DepartmentCompany = document.getElementById("txtDepartmentCompany").value; //8

            //             
            //            //            SetCookie("AdmissionRegistryEnquiry_station", station);
            //            //            SetCookie("AdmissionRegistryEnquiry_dateFrom", dateFrom);
            //            //            SetCookie("AdmissionRegistryEnquiry_dateTo", dateTo);
            //            //            SetCookie("AdmissionRegistryEnquiry_FreeTextcblShow", FreeTextcblShow);
            //            //            SetCookie("AdmissionRegistryEnquiry_StaffID", StaffID);
            //            //            SetCookie("AdmissionRegistryEnquiry_StaffName", StaffName);
            //            //            SetCookie("AdmissionRegistryEnquiry_ReturnItemOs", ReturnItemOs);
            //            //            SetCookie("AdmissionRegistryEnquiry_DepartmentCompany", DepartmentCompany);

            //            var CookieValue = '{ "Station":"' + station + '", "DateFrom":"' + dateFrom + '", "DateTo":"' + dateTo + '", "List":"' + FreeTextcblShow + '", "StaffID":"' + StaffID + '", "StaffName":"' + StaffName + '", "ReturnItemOs":"' + ReturnItemOs + '", "DepartmentCompany":"' + DepartmentCompany + '"}';
            //            var pathName = window.document.location.pathname;
            //            var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1);
            //            SetCookie("AssetLoan_Common", CookieValue, "", projectName + "/");
            //            /*******************add by jack 20151202 for using session store enquiry condition end**********************/

            //            window.location.href = (url + "&isBack=1&PageID=AssetLoanEnquiry");
            //End added by Nathan 2015-08-15
        }
        //added by Nathan 2015-08-15
        function setSearchCookie() {
            /*******************add by jack 20151202 for using session store enquiry condition start**********************/
            //            var isBack = getQueryString("isBack");
            //            if (isBack == "1") {
            //                // edit by jack 20151130 for cookie save
            //                // var station = GetCookie("AdmissionRegistryEnquiry_station");
            //                var AssetLoan = eval('(' + GetCookie("AssetLoan_Common") + ')');
            //                var station = AssetLoan.Station;
            //                if (station != "" && station != null) {
            //              
            //                    //document.getElementById("ddlStation").value = GetCookie("AdmissionRegistryEnquiry_station");
            //                    //document.getElementById("dtbFromDate_dateTextBox").value = GetCookie("AdmissionRegistryEnquiry_dateFrom");
            //                    //document.getElementById("dtbToDate_dateTextBox").value = GetCookie("AdmissionRegistryEnquiry_dateTo");
            //                    //var showValue = GetCookie("AdmissionRegistryEnquiry_FreeTextcblShow");
            //                    //setChackboxListValue("chklShow", showValue);
            //                    //document.getElementById("txtStaffID").value = GetCookie("AdmissionRegistryEnquiry_StaffID");
            //                    //document.getElementById("txtStaffName").value = GetCookie("AdmissionRegistryEnquiry_StaffName");

            //                    document.getElementById("ddlStation").value = station;
            //                    document.getElementById("dtbFromDate_dateTextBox").value = AssetLoan.DateFrom;
            //                    document.getElementById("dtbToDate_dateTextBox").value = AssetLoan.DateTo;
            //                    var showValue = AssetLoan.List;
            //                    setChackboxListValue("chklShow", showValue);
            //                    document.getElementById("txtStaffID").value = AssetLoan.StaffID;
            //                    document.getElementById("txtStaffName").value = AssetLoan.StaffName;

            //                    //if (GetCookie("AdmissionRegistryEnquiry_ReturnItemOs").toUpperCase() == "TRUE") {
            //                    if (AssetLoan.ReturnItemOs.toUpperCase() == "TRUE") {
            //                        document.getElementById("cbxReturnItemOs").checked = true;
            //                    } else {
            //                        document.getElementById("cbxReturnItemOs").checked = false;
            //                    }

            //                    //document.getElementById("txtDepartmentCompany").value = GetCookie("AdmissionRegistryEnquiry_DepartmentCompany");
            //                    document.getElementById("txtDepartmentCompany").value = AssetLoan.DepartmentCompany;

            //                }
            //                //                SetCookie("AdmissionRegistryEnquiry_station", "");
            //                //                SetCookie("AdmissionRegistryEnquiry_dateFrom", "");
            //                //                SetCookie("AdmissionRegistryEnquiry_dateTo", "");
            //                //                SetCookie("AdmissionRegistryEnquiry_FreeTextcblShow", "");
            //                //                SetCookie("AdmissionRegistryEnquiry_StaffID", "");
            //                //                SetCookie("AdmissionRegistryEnquiry_StaffName", "");
            //                //                SetCookie("AdmissionRegistryEnquiry_ReturnItemOs", "");
            //                //                SetCookie("AdmissionRegistryEnquiry_DepartmentCompany", "");
            //                var pathName = window.document.location.pathname;
            //                var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1);
            //                SetCookie("AssetLoan_Common", "", -1000, projectName + "/");
            //            }
            document.getElementById("btnSearch").click();

            /*******************add by jack 20151202 for using session store enquiry condition end**********************/
        }
        //End added by Nathan 2015-08-15
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <AjaxControlToolkit:ToolkitScriptManager ID="ToolkitScriptManager" runat="server">
    </AjaxControlToolkit:ToolkitScriptManager>
    <!-------add by jack 20151202 for using session store enquiry condition start----->
    <asp:HiddenField ID="HiddenFieldUrl" runat="server" />
    <asp:Button ID="btnSetSession" runat="server" Text="SetSession" OnClick="btnSetSession_Click"
        Style="display: none" />
    <!-------add by jack 20151202 for using session store enquiry condition end----->
    <table border="0" cellpadding="0" cellspacing="0" class="Page_Container">
        <tr>
            <td colspan="2" class="Page_Head">
                <WebStructure:PageHead ID="PageHead" runat="server" />
            </td>
        </tr>
        <tr>
            <td class="Page_Left">
                <WebStructure:MainMenu ID="MainMenu" runat="server" AppPath="../../" CurrMenuID="M1404" />
            </td>
            <td class="Page_Right">
                <table class="Page_Contents">
                    <tr>
                        <td class="TabStrip">
                            <WebStructure:TabStrip ID="TabStrip" CurrMenuID="M140401" ParentMenuID="M1404" DMenuMode="CurrOnly"
                                runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td class="Contents" style="height: 16px">
                            <fieldset style="clear: both; margin-bottom: 5px; background-color: #eeeeee;">
                                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                    <tr>
                                        <td>
                                            <asp:Label ID="lblStation" runat="server"></asp:Label>
                                        </td>
                                        <td>
                                            <asp:DropDownList ID="ddlStation" runat="server" CssClass="ddlStation">
                                            </asp:DropDownList>
                                        </td>
                                        <td>
                                            <asp:Label ID="lblFrom" runat="server"></asp:Label>
                                        </td>
                                        <td>
                                            <APJ:DateTextBox ID="dtbFromDate" runat="server"></APJ:DateTextBox>
                                            <asp:Label ID="lblTo" runat="server"></asp:Label>
                                            <APJ:DateTextBox ID="dtbToDate" runat="server"></APJ:DateTextBox>
                                        </td>
                                        <td>
                                            <asp:Label ID="lblShow" runat="server"></asp:Label>
                                        </td>
                                        <td>
                                            <asp:CheckBoxList ID="chklShow" runat="server" RepeatColumns="4" RepeatDirection="horizontal"
                                                CssClass="tableborder" TextAlign="right">
                                            </asp:CheckBoxList>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td nowrap="nowrap">
                                            <asp:Label ID="lblStaffID" runat="server"></asp:Label>
                                        </td>
                                        <td nowrap="nowrap">
                                            <input type="text" id="txtStaffID" runat="server" maxlength="20" style="width: 90px" />
                                            <%-- Update by jack 20150707 for U92 --%>
                                            <%--<input id="imgSearchStaff" type="image" src="../../Images/Common/view.png" onclick="OpenStaffContractorForm(); return false;" />--%>
                                            <input id="imgSearchStaff" type="image" src="../../Images/Common/view.png" onclick="OpenStaffContractorForm(); return false;"
                                                style="display: none;" />
                                            <%-- ****************************** --%>
                                        </td>
                                        <td nowrap="nowrap">
                                            <asp:Label ID="lblStaffName" runat="server"></asp:Label>
                                        </td>
                                        <td nowrap="nowrap">
                                            <input type="text" id="txtStaffName" runat="server" maxlength="50" style="width: 120px" />
                                        </td>
                                        <td>
                                            &nbsp;&nbsp;
                                        </td>
                                        <td>
                                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                            <asp:CheckBox ID="cbxReturnItemOs" runat="server" Text="Returned Item in O/S event" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td nowrap="nowrap">
                                            <asp:Label ID="lblDepartmentCompany" runat="server"></asp:Label>
                                        </td>
                                        <td nowrap="nowrap" colspan="5">
                                            <input type="text" id="txtDepartmentCompany" runat="server" maxlength="50" style="width: 180px" />
                                            <%-- Update by jack 20150707 for U92 --%>
                                            <%--<input type="image" id="imgSearchDepartmentCompany" src="../../Images/Common/view.png"
                                                onclick="OpenDepartmentCompany(); return false;" />--%>
                                            <input type="image" id="imgSearchDepartmentCompany" src="../../Images/Common/view.png"
                                                onclick="OpenDepartmentCompany(); return false;" style="display: none;" />
                                            <%-- ****************************** --%>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td nowrap="nowrap" colspan="6">
                                            <div style="float: right">
                                                <%-- update by gordon 20150812 | For Search Wait Cursor --%>
                                                <%--<input type="button" id="btnSearch" runat="server" />--%>
                                                <input type="button" id="btnSearch" onclick="showWait('../../CSS/ForAdmRegWaitCursor.css');"
                                                    runat="server" />
                                                <input type="button" id="btnNew" runat="server" />
                                                <%--
                                                update by gordon 20150910
                                                <input type="button" id="btnExporttoExcel" runat="server" />--%>
                                                <input type="button" id="btnExporttoExcel" onclick="return ExportClick('../../CSS/ForAdmRegWaitCursor.css',this.id);"
                                                    runat="server" />
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </fieldset>
                            <asp:UpdatePanel ID="AssetLoanEnquiryUpdatePanel" runat="server" UpdateMode="Conditional">
                                <ContentTemplate>
                                    <input type="hidden" runat="server" id="hdnBoolClkBtn" />
                                    <input type="hidden" runat="server" id="hdnCacheDataReturnInt" value="0" />
                                    <input type="hidden" id="txtContactNo" />
                                    <APJ:CommonGridView ID="grdAssetLoanEnquiry" runat="server" DataKeyNames="StationEventID,StationEventAdmRegID,ParentStationEventID"
                                        AllowPaging="True" AutoGenerateColumns="False" BorderColor="black" CssClass="GridView"
                                        AllowSorting="True" OnRowDataBound="grdAssetLoanEnquiry_RowDataBound">
                                        <PagerSettings Position="Top"></PagerSettings>
                                        <Columns>
                                            <%-- Update by jack 20150528 for U34 --%>
                                            <%--<asp:TemplateField HeaderText="SOM_EventNo" SortExpression="EventNo" ItemStyle-Width="120px" HeaderStyle-Width="120px">--%>
                                            <asp:TemplateField HeaderText="SOM_EventNo" SortExpression="EventNo" ItemStyle-Width="170px"
                                                HeaderStyle-Width="170px">
                                                <%-- ******************************* --%>
                                                <ItemTemplate>
                                                    <%--CssClass="HandCursorClass"--%>
                                                    <asp:HyperLink ID="hypLinkEventNo" CssClass="HandCursorClass" runat="server" Text='<%# Bind("EventNo") %>'></asp:HyperLink>
                                                    <asp:HyperLink ID="hypLinkAdminReg" CssClass="HandCursorClass" runat="server">HyperLink</asp:HyperLink>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:BoundField DataField="DepartmentCompany" HeaderText="SOM_DepartmentCompany"
                                                SortExpression="DepartmentCompany"></asp:BoundField>
                                            <%-- Update by jack 20150611 for U25--%>
                                            <%--<asp:BoundField DataField="AssetTypeCode" HeaderText="SOM_AssetType" SortExpression="AssetTypeCode" ItemStyle-Width="80px" HeaderStyle-Width="80px"></asp:BoundField>
                                        <asp:BoundField DataField="AssetItemCode" HeaderText="SOM_AssetItem" SortExpression="AssetItemCode" ItemStyle-Width="90px" HeaderStyle-Width="90px"></asp:BoundField>--%>
                                            <asp:BoundField DataField="AssetTypeDesc" HeaderText="SOM_AssetType" SortExpression="AssetTypeDesc"
                                                ItemStyle-Width="80px" HeaderStyle-Width="80px"></asp:BoundField>
                                            <asp:BoundField DataField="AssetItemDesc" HeaderText="SOM_AssetItem" SortExpression="AssetItemDesc"
                                                ItemStyle-Width="90px" HeaderStyle-Width="90px"></asp:BoundField>
                                            <%--********************************--%>
                                            <asp:TemplateField HeaderText="SOM_LoanReturnQuantity" SortExpression="NumOfLoanItem">
                                                <ItemTemplate>
                                                    <asp:Label ID="lblLoanReturnQuantity" runat="server"></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:BoundField DataField="StaffName" HeaderText="SOM_BorrowerName" SortExpression="StaffName">
                                            </asp:BoundField>
                                            <asp:TemplateField HeaderText="SOM_BorrowReturnDateTime" SortExpression="LoanTime"
                                                ItemStyle-Width="120px">
                                                <ItemTemplate>
                                                    <asp:Label ID="lblBorrowReturnDateTime" runat="server"></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField Visible="false">
                                                <HeaderStyle BorderStyle="None" />
                                                <ItemTemplate>
                                                    <%# Eval("EventStatusID")%>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="COM_Status" SortExpression="EventStatusID">
                                                <ItemTemplate>
                                                    <asp:Image ID="Image1" runat="server"></asp:Image>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField Visible="false">
                                                <HeaderStyle BorderStyle="None" />
                                                <ItemTemplate>
                                                    <%# Eval("FlagHandover")%>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="SOM_Handover" SortExpression="FlagHandover">
                                                <ItemTemplate>
                                                    <asp:Image ID="Image2" runat="server"></asp:Image>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField Visible="false">
                                                <HeaderStyle BorderStyle="None" />
                                                <ItemTemplate>
                                                    <%# Eval("HighLight")%>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="SOM_HighLight" SortExpression="HighLight">
                                                <ItemTemplate>
                                                    <asp:Image ID="Image3" runat="server"></asp:Image>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField Visible="false">
                                                <HeaderStyle BorderStyle="None" />
                                                <ItemTemplate>
                                                    <%# Eval("StationEventAdmRegID")%>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField Visible="false">
                                                <HeaderStyle BorderStyle="None" />
                                                <ItemTemplate>
                                                    <asp:Label ID="lblHandoverNote" runat="server" Text='<%# Eval("HandoverNote")%>' />
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField Visible="false">
                                                <HeaderStyle BorderStyle="None" />
                                                <ItemTemplate>
                                                    <%# Eval("ParentStationEventID")%>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                        </Columns>
                                        <RowStyle CssClass="GridView_Row"></RowStyle>
                                        <HeaderStyle CssClass="GridView_Header"></HeaderStyle>
                                        <AlternatingRowStyle CssClass="GridView_AlternativeRow"></AlternatingRowStyle>
                                    </APJ:CommonGridView>
                                    </td> </tr>
                                    <tr>
                                        <td class="Page_Foot" style="height: 54px">
                                            <WebStructure:PageFoot ID="PageFoot" runat="server" />
                                        </td>
                                    </tr>
                                    </table> </td> </tr> </table>
                                </ContentTemplate>
                                <Triggers>
                                    <asp:AsyncPostBackTrigger ControlID="btnSearch" />
                                </Triggers>
                            </asp:UpdatePanel>
    </form>
</body>
<script type="text/javascript">
    setSearchCookie();
</script>
</html>
